package org.jeecg.modules.htxincailiao.industry.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.htxincailiao.industry.entity.HTIndustryMeetingCheck;

import java.util.List;

/**
 * @Description: ht_industry_meeting_check
 * @Author: jeecg-boot
 * @Date: 2021-12-21 17:55:12
 * @Version: V1.0
 */
public interface HTIndustryMeetingCheckMapper extends BaseMapper<HTIndustryMeetingCheck> {

    @Select("<script>" +
            "SELECT * FROM ht_industry_meeting_check" + " " +
            "WHERE meeting_id=#{meetingId} AND code=#{code}" +
            "</script>")
    HTIndustryMeetingCheck queryByCode(@Param("meetingId") String meetingId, @Param("code") String code);

    @Select("<script>" +
            "SELECT * FROM ht_industry_meeting_check" + " " +
            "WHERE meeting_id=#{meetingId} AND user_id=#{userId}" +
            "</script>")
    HTIndustryMeetingCheck queryByUser(@Param("meetingId") String meetingId, @Param("userId") String userId);


    @Select("<script>" +
            "SELECT * FROM ht_industry_meeting_check" + " " +
            "WHERE meeting_id=#{meetingId} AND buyer_id=#{buyerId}" +
            "</script>")
    HTIndustryMeetingCheck queryByBuyerId(@Param("meetingId") String meetingId, @Param("buyerId") String buyerId);

    @Select("<script>" +
            "SELECT COUNT(*) FROM ht_industry_meeting_check" + " " +
            "WHERE meeting_id=#{meetingId} AND is_checked_in=1" +
            "</script>")
    Integer getCheckSerialNumber(@Param("meetingId") String meetingId);

    @Select("<script>" +
            "SELECT * FROM ht_industry_meeting_check" + " " +
            "WHERE meeting_id=#{meetingId} AND buyer_id=#{buyerId}" +
            "</script>")
    List<HTIndustryMeetingCheck> findAll(@Param("meetingId") String meetingId, @Param("buyerId") String buyerId);

}
